package com.lujianfei.netease_android_mvp

import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import com.lujianfei.netease_android_mvp.adapter.MainAdapter
import com.lujianfei.netease_android_mvp.bean.MainBean
import com.lujianfei.netease_android_mvp.presenter.MainPresenter
import kotlinx.android.synthetic.main.activity_main.*
import java.util.*

class MainActivity : AppCompatActivity(), MainContract.View {

    private val mPresenter by lazy { MainPresenter(this) }
    private val mAdapter = MainAdapter()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        listview.adapter = mAdapter
        mPresenter.loadData()
    }

    override fun setData(data: ArrayList<MainBean>) {
        mAdapter.setData(data)
    }

    override fun showLoading() {
        progressbar.visibility = View.VISIBLE
    }

    override fun hideLoading() {
        progressbar.visibility = View.GONE
    }
}
